<extend name="Public/base"/>

<block name="body">
    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>应用版本管理  <button class="btn btn-default btn-return" onclick="javascript:history.back(-1);return false;"><i class="glyphicon glyphicon-share-alt"></i> 返 回</button></h2>
    </div>
    <div class="tab-content">
    <form action="" method="post" class="form">

        <div id="tab1" class="tab-pane in tab1">

            <div class="form-item form-group">
                <label class="item-label">手机系统<span class="check-tips"></span></label>
                <div class="controls">
                    <select id="type" name="type">
                        <option value="0">---请选择---</option>
                        <volist name="options.type" id="op">
                        <option value="{$key}">{$op}</option>
                        </volist>
                    </select>
                </div>
            </div>
            
            <div class="form-item form-group">
                <label class="item-label">内部版本号<span class="check-tips">(用于版本更新 只能输入整型数值 )</span></label>
                <div class="controls">
                    <input type="text" class="text form-control input-small" name="internal_version" value="{$internal_version}">
                </div>
            </div>

            <div class="form-item form-group">
                <label class="item-label">外部版本号<span class="check-tips">(对外展示)</span></label>
                <div class="controls">
                    <input type="text" class="text form-control input-small" name="outer_version" value="{$outer_version}" placeholder="1.2.11">
                </div>
            </div>

            <div class="form-item form-group">
                <label class="item-label">url<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="text" class="text form-control input-large" name="url" value="{$url}">
                </div>
            </div>

            <div class="form-item form-group">
                <label class="item-label">MD5<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="text" class="text form-control input-large" name="md5" value="{$md5}">
                </div>
            </div>

            <div class="form-item form-group">
                <label class="item-label">描述<span class="check-tips"></span></label>
                <div class="controls">
                    <label class="input-large">
                        <textarea class="form-control" rows="4" name="detail">{$detail|htmlspecialchars_decode}</textarea>
                    </label>
                </div>
            </div>

            <div class="form-item form-group">
                <label class="item-label">更新日志<span class="check-tips"></span></label>
                <div class="controls">
                    <label class="input-large">
                        <textarea class="form-control" rows="4" name="log">{$log|htmlspecialchars_decode}</textarea>
                    </label>
                </div>
            </div>

            <div class="form-item form-group">
                <label class="item-label">更新文档<span class="check-tips"></span></label>
                <div class="controls">
                    <label class="input-large">
                        <textarea class="form-control" rows="4" name="update_info">{$update_info}</textarea>
                    </label>
                </div>
            </div>

            <div class="form-item form-group">
                <label class="item-label">是否强制更新<span class="check-tips"></span></label>
                <label class="radio-inline">
                <input type="radio" name="force_update" value="1"  /> 是
                </label>
                <label class="radio-inline">
                <input type="radio" name="force_update" value="0"  /> 否
                </label>
            </div>

            <div class="form-item form-group">
                <label class="item-label">状态<span class="check-tips"></span></label>
                <label class="radio-inline" >
                <input type="radio" name="status" value="1"  /> 开启
                </label>
                <label class="radio-inline">
                <input type="radio" name="status" value="0"  /> 关闭
                </label>
            </div>

        </div>

        <div class="form-item form-group form-action">
            <input type="hidden" name="id" value="{$id}" />
            <button class="btn submit-btn ajax-post btn-success btn-block" id="submit" type="submit" target-form="form">确 定</button>
            <!-- <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button> -->
        </div>
    </form>
    </div>
    <div id="video-pre">
        <video controls="controls" autoplay="autoplay"></video>
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('index')}');
        showTab();
        $('#game_id').change(function(){
            var game_id = $(this).val();
            var url = "{:U('ajax_get_matches_options')}";
            var data = {game_id: game_id};
            $.get(url, data, function(res){
                $('#match_id').empty();
                var options = '<option value="0">---请选择---</option>';
                if (res)
                {
                    $.each(res, function(index){
                        options += '<option value="'+index+'">'+res[index]+'</option>';
                    });
                }
                $('#match_id').append(options);
            });
        });

        $('.JS_type').click(function(){
            var type = $(this).val();
            if (type == 'match')
            {
                $('#match_field').show();
            }
            else
            {
                $('#match_id').val(0);
                $('#match_field').hide();
            }
        })
        var is_type = '{$type|default=normal}'
        $('#match_field').hide();
        Think.setValue("type", '{$type}');
        Think.setValue("status", '{$status}');
        Think.setValue("force_update", '{$force_update}');
        Think.setValue("page", '{$page}');
        $('.js-pre-video').on('click',function(){
            var url=$(this).attr('href');
            // alert(url);
            $('#video-pre').addClass('show').find('video').attr('src',url);
            return false;
        });
        $('video').click(function(e){
            return false;
        });
        $('#video-pre').click(function(){
            $(this).find('video').attr('src','');
            $(this).removeClass('show');
        });
    </script>
</block>
